/*************************************************************************
	> File Name: test2.cc
	> Author: H.M. Lau
	> Mail: hm.lau@outlook.com
	> Created Time: 2023/09/19 13:46
 ************************************************************************/

#include <iostream>
#include <signal.h>

void handler(int signum)
{
    sleep(1);
    std::cout << "Get a signal:" << signum << std::endl;
}
int main(int argc, char *argv[])
{
    signal(SIGSEGV, handler);
    int *p = nullptr;
    *p = 100;
    while (1) {
        sleep(1);
    }
    return 0;
}
